<template>
	<view class="fill-code">
		<view class="input">
			<input type="text" v-model="code" placeholder="请输入邀请码"/>
			<view class="toast">
				邀请码只能填写一次，请认真填写
			</view>
			<view class="btn">
				<button type="default" :loading="loading" @click="submit()">确定</button>
			</view>
		</view>
		<!-- <view class="noCode">
			<view class="shares">
				<text>推荐邀请码</text>
				<text></text>
			</view>
		</view> -->
		<!-- #ifdef APP-PLUS -->
		<view class="news-flow-fixed">
			<news-flow :type="5"></news-flow>
		</view>
		<!-- #endif -->
	</view>
</template>

<script>
	import {completeTask} from "@/api/activity.js"
	export default{
		name:"fillcode",
		data(){
			return{
				code:'',
				loading:false
			}
		},
		methods:{
			async submit(){
				if(!this.code){
					this.$msg("请输入邀请码")
					return;
				}
				this.loading = true;
				let res = await completeTask({keyword:"fill_code",code:this.code})
				if(res.code === 1){
					this.loading = false;
					uni.navigateBack()
				}else{
					this.loading = false;
				}
				this.$msg(res.msg)
			}
		}
	}
</script>

<style lang="less" scoped src="./fillcode.less">
</style>
